<?php
class Cl_PostTag extends WdkClass 
{
	protected
		/******************************************************/
		//	원본 테이블 정보
		/******************************************************/
		$post_tag_seq	= 0		,	//	
		$fk_post_seq	= 0		,	//	
		$post_tag_code	= ''	,	//	
		$post_tag_name	= ''	;	//	
		/******************************************************/
		//	추가 정보
		/******************************************************/
	
	/**
	 * 	
	 */
	function __construct()
	{
		parent::__construct();
		self::getDbo();
	}
	
	/**
	 *	
	 */
	public function __init($data)
	{
		parent::__init($data);
		self::dformat();
	}
	
	/**
	 *	
	 */
	public function load($post_tag_seq)
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/
		self::__init($dbo->cLoad($post_tag_seq));
	}
	
	/**
	 *	
	 */
	public function loadByName($fk_post_seq=0, $name='')
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/
		self::__init($dbo->cLoadByCode($fk_post_seq, md5(trim($name))));
	}
	
	/**
	 *	
	 */
	public function dformat()
	{
	
	}
	
	/**
	 *	
	 */
	public function insert()
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/
		
		$this->post_tag_code	= md5(trim($this->post_tag_name));
		$data = array(	'fk_post_seq'	=>	$this->fk_post_seq,
						'post_tag_code'	=>	$this->post_tag_code,
						'post_tag_name'	=>	$this->post_tag_name
					);
		$dbo->insert($data);
	}
	
	/**
	 *	
	 */
	public function delete()
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/
		$dbo->pdelete("`post_tag_seq` = {$this->post_tag_seq}");
	}
	
	/**
	 *	
	 */
	private function backup($log='')
	{
		throw new MethodNotImplementedException("백업은 제공하지 않는 기능입니다.");
	}
	
	/**
	 * 
	 */
	public function getDbo()
	{
		return Wdk::model(substr(__CLASS__, 3));
	}
}